<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>KING神电竞 - 测试页面</title>
    <style>
        .modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); }
        .modal-content { background: white; margin: 15% auto; padding: 20px; width: 300px; border-radius: 10px; }
        .admin-dashboard { display: none; background: white; padding: 20px; margin: 20px; border-radius: 10px; }
        button { padding: 10px 20px; margin: 10px; cursor: pointer; }
        .form-group { margin: 10px 0; }
        input { padding: 8px; width: 100%; }
    </style>
</head>
<body>
    <h1>测试管理员登录</h1>
    <button onclick="openAdminModal()">管理员登录</button>
    
    <!-- 登录模态框 -->
    <div id="adminModal" class="modal">
        <div class="modal-content">
            <h2>管理员登录</h2>
            <form onsubmit="handleLogin(event)">
                <div class="form-group">
                    <label>用户名</label>
                    <input type="text" id="adminUser" required>
                </div>
                <div class="form-group">
                    <label>密码</label>
                    <input type="password" id="adminPass" required>
                </div>
                <button type="submit">登录</button>
                <button type="button" onclick="closeAdminModal()">取消</button>
            </form>
        </div>
    </div>
    
    <!-- 管理后台 -->
    <div id="adminDashboard" class="admin-dashboard">
        <h2>管理后台</h2>
        <p>登录成功！这是管理后台</p>
        <button onclick="logoutAdmin()">退出</button>
    </div>
    
    <script>
        function openAdminModal() {
            console.log('打开登录窗口');
            document.getElementById('adminModal').style.display = 'block';
        }
        
        function closeAdminModal() {
            console.log('关闭登录窗口');
            document.getElementById('adminModal').style.display = 'none';
        }
        
        function handleLogin(event) {
            event.preventDefault();
            const username = document.getElementById('adminUser').value;
            const password = document.getElementById('adminPass').value;
            
            if (username === 'admin' && password === 'king888') {
                alert('登录成功！');
                document.getElementById('adminModal').style.display = 'none';
                document.getElementById('adminDashboard').style.display = 'block';
            } else {
                alert('用户名或密码错误！');
            }
        }
        
        function logoutAdmin() {
            document.getElementById('adminDashboard').style.display = 'none';
            alert('已退出');
        }
        
        // 点击空白处关闭模态框
        window.onclick = function(event) {
            const modal = document.getElementById('adminModal');
            if (event.target === modal) {
                closeAdminModal();
            }
        }
    </script>
</body>
</html>